package com.doit.day01;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.*;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;

public class _12_删除数据 {
    public static void main(String[] args) throws IOException {
        Configuration conf = HBaseConfiguration.create();
        //设置参数
        conf.set("hbase.zookeeper.quorum","linux01:2181,linux02:2181,linux03:2181");
        //创建连接对象
        Connection conn = ConnectionFactory.createConnection(conf);
        //获取连接对象
        Admin admin = conn.getAdmin();

        //table对象，这个对象就是用来对于表里面数据的操作
        Table table = conn.getTable(TableName.valueOf("test:teacher"));

        Delete delete = new Delete("rowkey002".getBytes(StandardCharsets.UTF_8));
        Delete delete1 = new Delete("rowkey004".getBytes(StandardCharsets.UTF_8));
        Delete delete2 = new Delete("rowkey006".getBytes(StandardCharsets.UTF_8));

        ArrayList<Delete> deletes = new ArrayList<>();
        deletes.add(delete);
        deletes.add(delete1);
        deletes.add(delete2);

        table.delete(deletes);


    }
}
